/*********************************************************************
	Rhapsody	: 7.5 
	Login		: kbe
	Component	: DefaultComponent 
	Configuration 	: CodeConfig
	Model Element	: Acceptor
//!	Generated Date	: Thu, 13, Sep 2012  
	File Path	: DefaultComponent\CodeConfig\Acceptor.h
*********************************************************************/

#ifndef Acceptor_H
#define Acceptor_H

//#[ ignore
#ifdef _MSC_VER
// disable Microsoft compiler warning (debug information truncated)
#pragma warning(disable: 4786)
#endif
//#]

//## auto_generated
#include <oxf\oxf.h>
//## auto_generated
#include <string>
//## auto_generated
#include <algorithm>
//## auto_generated
#include "Default.h"
//## class Acceptor
#include "EventHandler.h"

//## auto_generated
class Reactor;

//## package Default

//## class Acceptor
template <class EVENT_HANDLER>
class Acceptor : public EventHandler {
    ////    Friends    ////
    
    ////    Constructors and destructors    ////
private:
	SOCK_Acceptor *acceptor_;

public :

    //## operation Acceptor(Reactor*,HANDLE)
	Acceptor(Reactor* reactor, HANDLE h)
	{
		handle = h;
		type = ACCEPT_EVENT;
		itsReactor = reactor;
	};

	Acceptor(Reactor* reactor, SOCK_Acceptor* acceptor) : acceptor_(acceptor)
	{
		handle = (HANDLE)acceptor->get_handle();
		itsReactor = reactor;
		itsReactor->registerHandler(*this, ACCEPT_EVENT);
	};
    
    //## auto_generated
    Acceptor()
	{
	};
    
    //## auto_generated
    virtual ~Acceptor()
	{
		delete acceptor_;		
	};
    
    ////    Operations    ////
    
    //## operation handleEvent(HANDLE,Event_Type)
    virtual void handleEvent(HANDLE h, Event_Type& et)
	{
		if (et == type)
		{   
    		SOCK_Stream *client_connection = new SOCK_Stream();
    		acceptor_->accepting(*client_connection); 
    		EVENT_HANDLER *eventHandler = new EVENT_HANDLER(itsReactor, client_connection);
		}
	};
};

#endif
/*********************************************************************
	File Path	: DefaultComponent\CodeConfig\Acceptor.h
*********************************************************************/
